home *** CD-ROM | disk | FTP | other *** search
- Path: rover.ucs.ualberta.ca!news
- From: ryangall@gpu.srv.ualberta.ca (Bobby Sixkiller)
- Newsgroups: comp.lang.c
- Subject: typedef double Poly[MAXPOLY] PROBLEM
- Date: 11 Jan 1996 09:32:01 GMT
- Organization: University of Alberta, Edmonton, Canada
- Message-ID: <4d2leh$14dm@pulp.ucs.ualberta.ca>
- NNTP-Posting-Host: async20-10.remote.ualberta.ca
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.2
-
-
- how can I send a (pointer to Poly) to a function, and access each index
- for updating? this is my definition....its for school, and the typedef
- double poly[MAXDEGREE] cannot be changed.....heres an example of one of
- the functions I tried. It bails out at n=4 ...probably cause thats the
- size of the pointer......it keeps crashing
-
-
- #define MAXDEGREE 200
-
- typedef double Poly[MAXDEGREE];
- typedef Poly * POLY;
-
- /* initialize the Poly P so all index's are 0 */
-
- int initPoly(POLY P)
- {
- int n;
- for(n=0; n<MAXDEGREE; n++)
- {
- *P[n]=0.0; /* can you see what Im trying to do here?!*/
- }
-
- }
-
- int main(void)
- {
- Poly P;
-
- initPoly(&P); /* initialize the polynomial */
- .
- .
- .
- }
-
- please e-mail me if you can help! thanks!
-
-